/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Copyright(c) 2020 - 2023 Allwinner Technology Co.,Ltd. All rights reserved. */
/*
 * Copyright (C) 2016 Allwinnertech
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Adjustable factor-based clock implementation
 */

#include "clk-sun8iw21.h"

/*
 * freq table from hardware, need follow rules
 * 1)   each table  named as
 *      factor_pll1_tbl
 *      factor_pll2_tbl
 *      ...
 * 2) for each table line
 *      a) follow the format PLLx(n, k, m, p, d1, d2, freq), and keep the
 *         factors order
 *      b) if any factor not used, skip it
 *      c) the factor is the value to write registers, not means factor + 1
 *
 *      example
 *      PLL1(9, 0, 0, 2, 60000000) means PLL1(n, k, m, p, freq)
 *      PLLVIDEO0(3, 0, 96000000) means PLLVIDEO0(n, m, freq)
 *
 */

/* PLLCPU(n, m, p, freq)	F_N8X8_M0X2_P16x2 */
struct sunxi_clk_factor_freq factor_pllcpu_tbl[] = {
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(11,	0,	2,	72000000U),
PLLCPU(12,	0,	2,	78000000U),
PLLCPU(13,	0,	2,	84000000U),
PLLCPU(14,	0,	2,	90000000U),
PLLCPU(15,	0,	2,	96000000U),
PLLCPU(16,	0,	2,	102000000U),
PLLCPU(17,	0,	2,	108000000U),
PLLCPU(18,	0,	2,	114000000U),
PLLCPU(19,	0,	2,	120000000U),
PLLCPU(20,	0,	2,	126000000U),
PLLCPU(21,	0,	2,	132000000U),
PLLCPU(22,	0,	2,	138000000U),
PLLCPU(23,	0,	2,	144000000U),
PLLCPU(24,	0,	2,	150000000U),
PLLCPU(25,	0,	2,	156000000U),
PLLCPU(26,	0,	2,	162000000U),
PLLCPU(27,	0,	2,	168000000U),
PLLCPU(28,	0,	2,	174000000U),
PLLCPU(29,	0,	2,	180000000U),
PLLCPU(30,	0,	2,	186000000U),
PLLCPU(31,	0,	2,	192000000U),
PLLCPU(32,	0,	2,	198000000U),
PLLCPU(33,	0,	2,	204000000U),
PLLCPU(34,	0,	2,	210000000U),
PLLCPU(35,	0,	2,	216000000U),
PLLCPU(36,	0,	2,	222000000U),
PLLCPU(37,	0,	2,	228000000U),
PLLCPU(38,	0,	2,	234000000U),
PLLCPU(39,	0,	2,	240000000U),
PLLCPU(40,	0,	2,	246000000U),
PLLCPU(41,	0,	2,	252000000U),
PLLCPU(42,	0,	2,	258000000U),
PLLCPU(43,	0,	2,	264000000U),
PLLCPU(44,	0,	2,	270000000U),
PLLCPU(45,	0,	2,	276000000U),
PLLCPU(46,	0,	2,	282000000U),
PLLCPU(47,	0,	2,	288000000U),
PLLCPU(48,	0,	2,	294000000U),
PLLCPU(49,	0,	2,	300000000U),
PLLCPU(50,	0,	2,	306000000U),
PLLCPU(51,	0,	2,	312000000U),
PLLCPU(52,	0,	2,	318000000U),
PLLCPU(53,	0,	2,	324000000U),
PLLCPU(54,	0,	2,	330000000U),
PLLCPU(55,	0,	2,	336000000U),
PLLCPU(56,	0,	2,	342000000U),
PLLCPU(57,	0,	2,	348000000U),
PLLCPU(58,	0,	2,	354000000U),
PLLCPU(59,	0,	2,	360000000U),
PLLCPU(60,	0,	2,	366000000U),
PLLCPU(61,	0,	2,	372000000U),
PLLCPU(62,	0,	2,	378000000U),
PLLCPU(63,	0,	2,	384000000U),
PLLCPU(64,	0,	2,	390000000U),
PLLCPU(65,	0,	2,	396000000U),
PLLCPU(66,	0,	2,	402000000U),
#endif
PLLCPU(16,	0,	0,	408000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(68,	0,	2,	414000000U),
PLLCPU(34,	0,	1,	420000000U),
PLLCPU(70,	0,	2,	426000000U),
PLLCPU(17,	0,	0,	432000000U),
PLLCPU(72,	0,	2,	438000000U),
PLLCPU(36,	0,	1,	444000000U),
PLLCPU(74,	0,	2,	450000000U),
PLLCPU(18,	0,	0,	456000000U),
PLLCPU(76,	0,	2,	462000000U),
PLLCPU(38,	0,	1,	468000000U),
PLLCPU(78,	0,	2,	474000000U),
PLLCPU(19,	0,	0,	480000000U),
PLLCPU(80,	0,	2,	486000000U),
PLLCPU(40,	0,	1,	492000000U),
PLLCPU(82,	0,	2,	498000000U),
PLLCPU(20,	0,	0,	504000000U),
PLLCPU(84,	0,	2,	510000000U),
PLLCPU(42,	0,	1,	516000000U),
PLLCPU(86,	0,	2,	522000000U),
PLLCPU(21,	0,	0,	528000000U),
PLLCPU(88,	0,	2,	534000000U),
PLLCPU(44,	0,	1,	540000000U),
PLLCPU(90,	0,	2,	546000000U),
PLLCPU(22,	0,	0,	552000000U),
PLLCPU(92,	0,	2,	558000000U),
PLLCPU(46,	0,	1,	564000000U),
PLLCPU(94,	0,	2,	570000000U),
PLLCPU(23,	0,	0,	576000000U),
PLLCPU(96,	0,	2,	582000000U),
PLLCPU(48,	0,	1,	588000000U),
PLLCPU(98,	0,	2,	594000000U),
#endif
PLLCPU(24,	0,	0,	600000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(50,	0,	1,	612000000U),
PLLCPU(25,	0,	0,	624000000U),
PLLCPU(52,	0,	1,	636000000U),
PLLCPU(26,	0,	0,	648000000U),
PLLCPU(54,	0,	1,	660000000U),
PLLCPU(27,	0,	0,	672000000U),
PLLCPU(56,	0,	1,	684000000U),
PLLCPU(28,	0,	0,	696000000U),
PLLCPU(58,	0,	1,	708000000U),
#endif
PLLCPU(29,	0,	0,	720000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(60,	0,	1,	732000000U),
PLLCPU(30,	0,	0,	744000000U),
PLLCPU(62,	0,	1,	756000000U),
PLLCPU(31,	0,	0,	768000000U),
PLLCPU(64,	0,	1,	780000000U),
PLLCPU(32,	0,	0,	792000000U),
PLLCPU(66,	0,	1,	804000000U),
PLLCPU(33,	0,	0,	816000000U),
PLLCPU(68,	0,	1,	828000000U),
PLLCPU(34,	0,	0,	840000000U),
PLLCPU(70,	0,	1,	852000000U),
PLLCPU(35,	0,	0,	864000000U),
PLLCPU(72,	0,	1,	876000000U),
PLLCPU(36,	0,	0,	888000000U),
PLLCPU(74,	0,	1,	900000000U),
#endif
PLLCPU(37,	0,	0,	912000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(76,	0,	1,	924000000U),
PLLCPU(38,	0,	0,	936000000U),
PLLCPU(78,	0,	1,	948000000U),
PLLCPU(39,	0,	0,	960000000U),
PLLCPU(80,	0,	1,	972000000U),
PLLCPU(40,	0,	0,	984000000U),
PLLCPU(82,	0,	1,	996000000U),
#endif
PLLCPU(41,	0,	0,	1008000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(84,	0,	1,	1020000000U),
PLLCPU(42,	0,	0,	1032000000U),
PLLCPU(86,	0,	1,	1044000000U),
PLLCPU(43,	0,	0,	1056000000U),
PLLCPU(88,	0,	1,	1068000000U),
PLLCPU(44,	0,	0,	1080000000U),
PLLCPU(90,	0,	1,	1092000000U),
#endif
PLLCPU(45,	0,	0,	1104000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLCPU(92,	0,	1,	1116000000U),
PLLCPU(46,	0,	0,	1128000000U),
PLLCPU(94,	0,	1,	1140000000U),
PLLCPU(47,	0,	0,	1152000000U),
PLLCPU(96,	0,	1,	1164000000U),
PLLCPU(48,	0,	0,	1176000000U),
PLLCPU(98,	0,	1,	1188000000U),
PLLCPU(49,	0,	0,	1200000000U),
PLLCPU(50,	0,	0,	1224000000U),
PLLCPU(51,	0,	0,	1248000000U),
PLLCPU(52,	0,	0,	1272000000U),
PLLCPU(53,	0,	0,	1296000000U),
PLLCPU(54,	0,	0,	1320000000U),
PLLCPU(55,	0,	0,	1344000000U),
PLLCPU(56,	0,	0,	1368000000U),
PLLCPU(57,	0,	0,	1392000000U),
PLLCPU(58,	0,	0,	1416000000U),
PLLCPU(59,	0,	0,	1440000000U),
PLLCPU(60,	0,	0,	1464000000U),
PLLCPU(61,	0,	0,	1488000000U),
PLLCPU(62,	0,	0,	1512000000U),
PLLCPU(63,	0,	0,	1536000000U),
PLLCPU(64,	0,	0,	1560000000U),
PLLCPU(65,	0,	0,	1584000000U),
PLLCPU(66,	0,	0,	1608000000U),
PLLCPU(67,	0,	0,	1632000000U),
PLLCPU(68,	0,	0,	1656000000U),
PLLCPU(69,	0,	0,	1680000000U),
PLLCPU(70,	0,	0,	1704000000U),
PLLCPU(71,	0,	0,	1728000000U),
PLLCPU(72,	0,	0,	1752000000U),
PLLCPU(73,	0,	0,	1776000000U),
PLLCPU(74,	0,	0,	1800000000U),
PLLCPU(75,	0,	0,	1824000000U),
PLLCPU(76,	0,	0,	1848000000U),
PLLCPU(77,	0,	0,	1872000000U),
PLLCPU(78,	0,	0,	1896000000U),
PLLCPU(79,	0,	0,	1920000000U),
PLLCPU(80,	0,	0,	1944000000U),
PLLCPU(81,	0,	0,	1968000000U),
PLLCPU(82,	0,	0,	1992000000U),
PLLCPU(83,	0,	0,	2016000000U),
PLLCPU(84,	0,	0,	2040000000U),
PLLCPU(85,	0,	0,	2064000000U),
PLLCPU(86,	0,	0,	2088000000U),
PLLCPU(87,	0,	0,	2112000000U),
PLLCPU(88,	0,	0,	2136000000U),
PLLCPU(89,	0,	0,	2160000000U),
PLLCPU(90,	0,	0,	2184000000U),
PLLCPU(91,	0,	0,	2208000000U),
PLLCPU(92,	0,	0,	2232000000U),
PLLCPU(93,	0,	0,	2256000000U),
PLLCPU(94,	0,	0,	2280000000U),
PLLCPU(95,	0,	0,	2304000000U),
PLLCPU(96,	0,	0,	2328000000U),
PLLCPU(97,	0,	0,	2352000000U),
PLLCPU(98,	0,	0,	2376000000U),
PLLCPU(99,	0,	0,	2400000000U),
PLLCPU(100,	0,	0,	2424000000U),
PLLCPU(101,	0,	0,	2448000000U),
PLLCPU(102,	0,	0,	2472000000U),
PLLCPU(103,	0,	0,	2496000000U),
PLLCPU(104,	0,	0,	2520000000U),
#endif
};

/* PLLDDR0(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
/* ISP VE DE CSI ISE device also use this table */
struct sunxi_clk_factor_freq factor_pllddr0_tbl[] = {
#ifndef CONFIG_SUNXI_FASTBOOT
PLLDDR0(47,	1,	1,	288000000U),
PLLDDR0(48,	1,	1,	294000000U),
PLLDDR0(49,	1,	1,	300000000U),
PLLDDR0(50,	1,	1,	306000000U),
PLLDDR0(51,	1,	1,	312000000U),
PLLDDR0(52,	1,	1,	318000000U),
PLLDDR0(53,	1,	1,	324000000U),
PLLDDR0(54,	1,	1,	330000000U),
PLLDDR0(55,	1,	1,	336000000U),
PLLDDR0(56,	1,	1,	342000000U),
PLLDDR0(57,	1,	1,	348000000U),
PLLDDR0(58,	1,	1,	354000000U),
PLLDDR0(59,	1,	1,	360000000U),
PLLDDR0(60,	1,	1,	366000000U),
PLLDDR0(61,	1,	1,	372000000U),
PLLDDR0(62,	1,	1,	378000000U),
PLLDDR0(31,	0,	1,	384000000U),
PLLDDR0(64,	1,	1,	390000000U),
PLLDDR0(32,	0,	1,	396000000U),
PLLDDR0(66,	1,	1,	402000000U),
PLLDDR0(33,	0,	1,	408000000U),
PLLDDR0(68,	1,	1,	414000000U),
PLLDDR0(34,	0,	1,	420000000U),
PLLDDR0(70,	1,	1,	426000000U),
PLLDDR0(35,	0,	1,	432000000U),
PLLDDR0(72,	1,	1,	438000000U),
PLLDDR0(36,	0,	1,	444000000U),
PLLDDR0(74,	1,	1,	450000000U),
PLLDDR0(37,	0,	1,	456000000U),
PLLDDR0(76,	1,	1,	462000000U),
PLLDDR0(38,	0,	1,	468000000U),
PLLDDR0(78,	1,	1,	474000000U),
PLLDDR0(39,	0,	1,	480000000U),
PLLDDR0(80,	1,	1,	486000000U),
PLLDDR0(40,	0,	1,	492000000U),
PLLDDR0(82,	1,	1,	498000000U),
PLLDDR0(41,	0,	1,	504000000U),
PLLDDR0(84,	1,	1,	510000000U),
PLLDDR0(42,	0,	1,	516000000U),
PLLDDR0(86,	1,	1,	522000000U),
#endif
PLLDDR0(43,	0,	1,	528000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLDDR0(88,	1,	1,	534000000U),
PLLDDR0(44,	0,	1,	540000000U),
PLLDDR0(90,	1,	1,	546000000U),
PLLDDR0(45,	0,	1,	552000000U),
PLLDDR0(92,	1,	1,	558000000U),
PLLDDR0(46,	0,	1,	564000000U),
PLLDDR0(94,	1,	1,	570000000U),
PLLDDR0(47,	0,	1,	576000000U),
PLLDDR0(96,	1,	1,	582000000U),
PLLDDR0(48,	0,	1,	588000000U),
PLLDDR0(98,	1,	1,	594000000U),
PLLDDR0(49,	0,	1,	600000000U),
PLLDDR0(50,	0,	1,	612000000U),
PLLDDR0(51,	0,	1,	624000000U),
PLLDDR0(52,	0,	1,	636000000U),
PLLDDR0(53,	0,	1,	648000000U),
PLLDDR0(54,	0,	1,	660000000U),
PLLDDR0(55,	0,	1,	672000000U),
PLLDDR0(56,	0,	1,	684000000U),
PLLDDR0(57,	0,	1,	696000000U),
PLLDDR0(58,	0,	1,	708000000U),
PLLDDR0(59,	0,	1,	720000000U),
PLLDDR0(60,	0,	1,	732000000U),
PLLDDR0(61,	0,	1,	744000000U),
PLLDDR0(62,	0,	1,	756000000U),
PLLDDR0(63,	0,	1,	768000000U),
PLLDDR0(64,	0,	1,	780000000U),
PLLDDR0(65,	0,	1,	792000000U),
PLLDDR0(66,	0,	1,	804000000U),
PLLDDR0(67,	0,	1,	816000000U),
PLLDDR0(68,	0,	1,	828000000U),
PLLDDR0(69,	0,	1,	840000000U),
PLLDDR0(70,	0,	1,	852000000U),
PLLDDR0(35,	0,	0,	864000000U),
PLLDDR0(72,	0,	1,	876000000U),
PLLDDR0(36,	0,	0,	888000000U),
PLLDDR0(74,	0,	1,	900000000U),
PLLDDR0(37,	0,	0,	912000000U),
PLLDDR0(76,	0,	1,	924000000U),
PLLDDR0(38,	0,	0,	936000000U),
PLLDDR0(78,	0,	1,	948000000U),
PLLDDR0(39,	0,	0,	960000000U),
PLLDDR0(80,	0,	1,	972000000U),
PLLDDR0(40,	0,	0,	984000000U),
PLLDDR0(82,	0,	1,	996000000U),
PLLDDR0(41,	0,	0,	1008000000U),
PLLDDR0(84,	0,	1,	1020000000U),
PLLDDR0(42,	0,	0,	1032000000U),
PLLDDR0(86,	0,	1,	1044000000U),
PLLDDR0(43,	0,	0,	1056000000U),
PLLDDR0(88,	0,	1,	1068000000U),
PLLDDR0(44,	0,	0,	1080000000U),
PLLDDR0(90,	0,	1,	1092000000U),
PLLDDR0(45,	0,	0,	1104000000U),
PLLDDR0(92,	0,	1,	1116000000U),
PLLDDR0(46,	0,	0,	1128000000U),
PLLDDR0(94,	0,	1,	1140000000U),
PLLDDR0(47,	0,	0,	1152000000U),
PLLDDR0(96,	0,	1,	1164000000U),
PLLDDR0(48,	0,	0,	1176000000U),
PLLDDR0(98,	0,	1,	1188000000U),
PLLDDR0(49,	0,	0,	1200000000U),
PLLDDR0(50,	0,	0,	1224000000U),
PLLDDR0(51,	0,	0,	1248000000U),
PLLDDR0(52,	0,	0,	1272000000U),
PLLDDR0(53,	0,	0,	1296000000U),
PLLDDR0(54,	0,	0,	1320000000U),
PLLDDR0(55,	0,	0,	1344000000U),
PLLDDR0(56,	0,	0,	1368000000U),
PLLDDR0(57,	0,	0,	1392000000U),
PLLDDR0(58,	0,	0,	1416000000U),
PLLDDR0(59,	0,	0,	1440000000U),
PLLDDR0(60,	0,	0,	1464000000U),
PLLDDR0(61,	0,	0,	1488000000U),
PLLDDR0(62,	0,	0,	1512000000U),
PLLDDR0(63,	0,	0,	1536000000U),
PLLDDR0(64,	0,	0,	1560000000U),
PLLDDR0(65,	0,	0,	1584000000U),
PLLDDR0(66,	0,	0,	1608000000U),
PLLDDR0(67,	0,	0,	1632000000U),
PLLDDR0(68,	0,	0,	1656000000U),
PLLDDR0(69,	0,	0,	1680000000U),
PLLDDR0(70,	0,	0,	1704000000U),
PLLDDR0(71,	0,	0,	1728000000U),
PLLDDR0(72,	0,	0,	1752000000U),
PLLDDR0(73,	0,	0,	1776000000U),
PLLDDR0(74,	0,	0,	1800000000U),
PLLDDR0(75,	0,	0,	1824000000U),
PLLDDR0(76,	0,	0,	1848000000U),
PLLDDR0(77,	0,	0,	1872000000U),
PLLDDR0(78,	0,	0,	1896000000U),
PLLDDR0(79,	0,	0,	1920000000U),
PLLDDR0(80,	0,	0,	1944000000U),
PLLDDR0(81,	0,	0,	1968000000U),
PLLDDR0(82,	0,	0,	1992000000U),
PLLDDR0(83,	0,	0,	2016000000U),
PLLDDR0(84,	0,	0,	2040000000U),
PLLDDR0(85,	0,	0,	2064000000U),
PLLDDR0(86,	0,	0,	2088000000U),
PLLDDR0(87,	0,	0,	2112000000U),
PLLDDR0(88,	0,	0,	2136000000U),
PLLDDR0(89,	0,	0,	2160000000U),
PLLDDR0(90,	0,	0,	2184000000U),
PLLDDR0(91,	0,	0,	2208000000U),
PLLDDR0(92,	0,	0,	2232000000U),
PLLDDR0(93,	0,	0,	2256000000U),
PLLDDR0(94,	0,	0,	2280000000U),
PLLDDR0(95,	0,	0,	2304000000U),
PLLDDR0(96,	0,	0,	2328000000U),
PLLDDR0(97,	0,	0,	2352000000U),
PLLDDR0(98,	0,	0,	2376000000U),
PLLDDR0(99,	0,	0,	2400000000U),
PLLDDR0(100,	0,	0,	2424000000U),
PLLDDR0(101,	0,	0,	2448000000U),
PLLDDR0(102,	0,	0,	2472000000U),
PLLDDR0(103,	0,	0,	2496000000U),
PLLDDR0(104,	0,	0,	2520000000U),
#endif
};

/* PLLPERIPH0(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
/* periph0 periph1 use this table */
struct sunxi_clk_factor_freq factor_pllperiph0x2_tbl[] = {
#ifndef CONFIG_SUNXI_FASTBOOT
#endif
PLLPERIPH0(99,	0,	1,	1200000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLPERIPH0(200,	0,	2,	1206000000U),
PLLPERIPH0(202,	0,	2,	1218000000U),
PLLPERIPH0(204,	0,	2,	1230000000U),
PLLPERIPH0(206,	0,	2,	1242000000U),
PLLPERIPH0(208,	0,	2,	1254000000U),
PLLPERIPH0(105,	0,	1,	1272000000U),
PLLPERIPH0(107,	0,	1,	1296000000U),
PLLPERIPH0(109,	0,	1,	1320000000U),
PLLPERIPH0(111,	0,	1,	1344000000U),
PLLPERIPH0(112,	0,	1,	1356000000U),
PLLPERIPH0(113,	0,	1,	1368000000U),
PLLPERIPH0(114,	0,	1,	1380000000U),
PLLPERIPH0(115,	0,	1,	1392000000U),
PLLPERIPH0(116,	0,	1,	1404000000U),
PLLPERIPH0(117,	0,	1,	1416000000U),
PLLPERIPH0(118,	0,	1,	1428000000U),
PLLPERIPH0(119,	0,	1,	1440000000U),
PLLPERIPH0(120,	0,	1,	1452000000U),
PLLPERIPH0(121,	0,	1,	1464000000U),
PLLPERIPH0(122,	0,	1,	1476000000U),
PLLPERIPH0(123,	0,	1,	1488000000U),
PLLPERIPH0(124,	0,	1,	1500000000U),
PLLPERIPH0(125,	0,	1,	1512000000U),
PLLPERIPH0(126,	0,	1,	1524000000U),
PLLPERIPH0(127,	0,	1,	1536000000U),
PLLPERIPH0(128,	0,	1,	1548000000U),
PLLPERIPH0(129,	0,	1,	1560000000U),
PLLPERIPH0(130,	0,	1,	1572000000U),
PLLPERIPH0(131,	0,	1,	1584000000U),
PLLPERIPH0(132,	0,	1,	1596000000U),
PLLPERIPH0(133,	0,	1,	1608000000U),
PLLPERIPH0(134,	0,	1,	1620000000U),
PLLPERIPH0(135,	0,	1,	1632000000U),
PLLPERIPH0(136,	0,	1,	1644000000U),
PLLPERIPH0(137,	0,	1,	1656000000U),
PLLPERIPH0(104,	0,	1,	1260000000U),
PLLPERIPH0(105,	0,	1,	1272000000U),
PLLPERIPH0(106,	0,	1,	1284000000U),
PLLPERIPH0(107,	0,	1,	1296000000U),
PLLPERIPH0(108,	0,	1,	1308000000U),
PLLPERIPH0(109,	0,	1,	1320000000U),
PLLPERIPH0(110,	0,	1,	1332000000U),
PLLPERIPH0(111,	0,	1,	1344000000U),
PLLPERIPH0(112,	0,	1,	1356000000U),
PLLPERIPH0(113,	0,	1,	1368000000U),
PLLPERIPH0(114,	0,	1,	1380000000U),
PLLPERIPH0(115,	0,	1,	1392000000U),
PLLPERIPH0(116,	0,	1,	1404000000U),
PLLPERIPH0(117,	0,	1,	1416000000U),
PLLPERIPH0(118,	0,	1,	1428000000U),
PLLPERIPH0(104,	0,	1,	1260000000U),
PLLPERIPH0(105,	0,	1,	1272000000U),
PLLPERIPH0(106,	0,	1,	1284000000U),
PLLPERIPH0(107,	0,	1,	1296000000U),
PLLPERIPH0(108,	0,	1,	1308000000U),
PLLPERIPH0(109,	0,	1,	1320000000U),
PLLPERIPH0(110,	0,	1,	1332000000U),
PLLPERIPH0(111,	0,	1,	1344000000U),
PLLPERIPH0(112,	0,	1,	1356000000U),
PLLPERIPH0(113,	0,	1,	1368000000U),
PLLPERIPH0(114,	0,	1,	1380000000U),
PLLPERIPH0(115,	0,	1,	1392000000U),
PLLPERIPH0(116,	0,	1,	1404000000U),
PLLPERIPH0(117,	0,	1,	1416000000U),
PLLPERIPH0(118,	0,	1,	1428000000U),
PLLPERIPH0(119,	0,	1,	1440000000U),
PLLPERIPH0(120,	0,	1,	1452000000U),
PLLPERIPH0(121,	0,	1,	1464000000U),
PLLPERIPH0(122,	0,	1,	1476000000U),
PLLPERIPH0(123,	0,	1,	1488000000U),
PLLPERIPH0(124,	0,	1,	1500000000U),
PLLPERIPH0(125,	0,	1,	1512000000U),
PLLPERIPH0(126,	0,	1,	1524000000U),
PLLPERIPH0(127,	0,	1,	1536000000U),
PLLPERIPH0(128,	0,	1,	1548000000U),
PLLPERIPH0(129,	0,	1,	1560000000U),
PLLPERIPH0(130,	0,	1,	1572000000U),
PLLPERIPH0(131,	0,	1,	1584000000U),
PLLPERIPH0(132,	0,	1,	1596000000U),
PLLPERIPH0(133,	0,	1,	1608000000U),
PLLPERIPH0(134,	0,	1,	1620000000U),
PLLPERIPH0(135,	0,	1,	1632000000U),
PLLPERIPH0(136,	0,	1,	1644000000U),
PLLPERIPH0(137,	0,	1,	1656000000U),
PLLPERIPH0(138,	0,	1,	1668000000U),
PLLPERIPH0(139,	0,	1,	1680000000U),
PLLPERIPH0(140,	0,	1,	1692000000U),
PLLPERIPH0(141,	0,	1,	1704000000U),
PLLPERIPH0(142,	0,	1,	1716000000U),
PLLPERIPH0(143,	0,	1,	1728000000U),
PLLPERIPH0(144,	0,	1,	1740000000U),
PLLPERIPH0(145,	0,	1,	1752000000U),
#endif
};

struct sunxi_clk_factor_freq factor_pllperiph0800m_tbl[] = {
#ifndef CONFIG_SUNXI_FASTBOOT
PLLPERIPH0(23,	0,	4,	144000000U),
PLLPERIPH0(24,	0,	4,	150000000U),
PLLPERIPH0(25,	0,	4,	156000000U),
PLLPERIPH0(26,	0,	4,	162000000U),
PLLPERIPH0(27,	0,	4,	168000000U),
PLLPERIPH0(28,	0,	4,	174000000U),
PLLPERIPH0(29,	0,	4,	180000000U),
PLLPERIPH0(30,	0,	4,	186000000U),
PLLPERIPH0(31,	0,	4,	192000000U),
PLLPERIPH0(32,	0,	4,	198000000U),
PLLPERIPH0(33,	0,	4,	204000000U),
PLLPERIPH0(34,	0,	4,	210000000U),
PLLPERIPH0(35,	0,	4,	216000000U),
PLLPERIPH0(36,	0,	4,	222000000U),
PLLPERIPH0(37,	0,	4,	228000000U),
PLLPERIPH0(38,	0,	4,	234000000U),
PLLPERIPH0(39,	0,	4,	240000000U),
PLLPERIPH0(40,	0,	4,	246000000U),
PLLPERIPH0(41,	0,	4,	252000000U),
PLLPERIPH0(42,	0,	4,	258000000U),
PLLPERIPH0(43,	0,	4,	264000000U),
PLLPERIPH0(44,	0,	4,	270000000U),
PLLPERIPH0(45,	0,	4,	276000000U),
PLLPERIPH0(46,	0,	4,	282000000U),
PLLPERIPH0(23,	0,	2,	288000000U),
PLLPERIPH0(48,	0,	4,	294000000U),
PLLPERIPH0(24,	0,	2,	300000000U),
PLLPERIPH0(50,	0,	4,	306000000U),
PLLPERIPH0(25,	0,	2,	312000000U),
PLLPERIPH0(52,	0,	4,	318000000U),
PLLPERIPH0(26,	0,	2,	324000000U),
PLLPERIPH0(54,	0,	4,	330000000U),
PLLPERIPH0(27,	0,	2,	336000000U),
PLLPERIPH0(56,	0,	4,	342000000U),
PLLPERIPH0(28,	0,	2,	348000000U),
PLLPERIPH0(58,	0,	4,	354000000U),
PLLPERIPH0(29,	0,	2,	360000000U),
PLLPERIPH0(60,	0,	4,	366000000U),
PLLPERIPH0(30,	0,	2,	372000000U),
PLLPERIPH0(62,	0,	4,	378000000U),
PLLPERIPH0(31,	0,	2,	384000000U),
PLLPERIPH0(64,	0,	4,	390000000U),
PLLPERIPH0(32,	0,	2,	396000000U),
PLLPERIPH0(66,	0,	4,	402000000U),
PLLPERIPH0(33,	0,	2,	408000000U),
PLLPERIPH0(68,	0,	4,	414000000U),
PLLPERIPH0(34,	0,	2,	420000000U),
PLLPERIPH0(70,	0,	4,	426000000U),
PLLPERIPH0(35,	0,	2,	432000000U),
PLLPERIPH0(72,	0,	4,	438000000U),
PLLPERIPH0(36,	0,	2,	444000000U),
PLLPERIPH0(74,	0,	4,	450000000U),
PLLPERIPH0(37,	0,	2,	456000000U),
PLLPERIPH0(76,	0,	4,	462000000U),
PLLPERIPH0(38,	0,	2,	468000000U),
PLLPERIPH0(78,	0,	4,	474000000U),
PLLPERIPH0(39,	0,	2,	480000000U),
PLLPERIPH0(80,	0,	4,	486000000U),
PLLPERIPH0(40,	0,	2,	492000000U),
PLLPERIPH0(82,	0,	4,	498000000U),
PLLPERIPH0(41,	0,	2,	504000000U),
PLLPERIPH0(84,	0,	4,	510000000U),
PLLPERIPH0(42,	0,	2,	516000000U),
PLLPERIPH0(86,	0,	4,	522000000U),
PLLPERIPH0(43,	0,	2,	528000000U),
PLLPERIPH0(88,	0,	4,	534000000U),
PLLPERIPH0(44,	0,	2,	540000000U),
PLLPERIPH0(90,	0,	4,	546000000U),
PLLPERIPH0(45,	0,	2,	552000000U),
PLLPERIPH0(92,	0,	4,	558000000U),
PLLPERIPH0(46,	0,	2,	564000000U),
PLLPERIPH0(94,	0,	4,	570000000U),
PLLPERIPH0(47,	0,	2,	576000000U),
PLLPERIPH0(96,	0,	4,	582000000U),
PLLPERIPH0(48,	0,	2,	588000000U),
PLLPERIPH0(98,	0,	4,	594000000U),
PLLPERIPH0(49,	0,	2,	600000000U),
PLLPERIPH0(100,	0,	4,	606000000U),
PLLPERIPH0(50,	0,	2,	612000000U),
PLLPERIPH0(102,	0,	4,	618000000U),
PLLPERIPH0(51,	0,	2,	624000000U),
PLLPERIPH0(104,	0,	4,	630000000U),
PLLPERIPH0(52,	0,	2,	636000000U),
PLLPERIPH0(106,	0,	4,	642000000U),
PLLPERIPH0(53,	0,	2,	648000000U),
PLLPERIPH0(108,	0,	4,	654000000U),
PLLPERIPH0(54,	0,	2,	660000000U),
PLLPERIPH0(110,	0,	4,	666000000U),
PLLPERIPH0(55,	0,	2,	672000000U),
PLLPERIPH0(112,	0,	4,	678000000U),
PLLPERIPH0(56,	0,	2,	684000000U),
PLLPERIPH0(114,	0,	4,	690000000U),
PLLPERIPH0(57,	0,	2,	696000000U),
PLLPERIPH0(116,	0,	4,	702000000U),
PLLPERIPH0(58,	0,	2,	708000000U),
PLLPERIPH0(118,	0,	4,	714000000U),
PLLPERIPH0(59,	0,	2,	720000000U),
PLLPERIPH0(120,	0,	4,	726000000U),
PLLPERIPH0(60,	0,	2,	732000000U),
PLLPERIPH0(122,	0,	4,	738000000U),
PLLPERIPH0(61,	0,	2,	744000000U),
PLLPERIPH0(124,	0,	4,	750000000U),
PLLPERIPH0(62,	0,	2,	756000000U),
PLLPERIPH0(126,	0,	4,	762000000U),
PLLPERIPH0(63,	0,	2,	768000000U),
PLLPERIPH0(128,	0,	4,	774000000U),
PLLPERIPH0(64,	0,	2,	780000000U),
PLLPERIPH0(130,	0,	4,	786000000U),
PLLPERIPH0(65,	0,	2,	792000000U),
PLLPERIPH0(132,	0,	4,	798000000U),
PLLPERIPH0(66,	0,	2,	804000000U),
PLLPERIPH0(134,	0,	4,	810000000U),
PLLPERIPH0(67,	0,	2,	816000000U),
PLLPERIPH0(136,	0,	4,	822000000U),
PLLPERIPH0(68,	0,	2,	828000000U),
PLLPERIPH0(138,	0,	4,	834000000U),
PLLPERIPH0(69,	0,	2,	840000000U),
PLLPERIPH0(140,	0,	4,	846000000U),
PLLPERIPH0(70,	0,	2,	852000000U),
PLLPERIPH0(142,	0,	4,	858000000U),
PLLPERIPH0(71,	0,	2,	864000000U),
PLLPERIPH0(144,	0,	4,	870000000U),
PLLPERIPH0(72,	0,	2,	876000000U),
PLLPERIPH0(146,	0,	4,	882000000U),
PLLPERIPH0(73,	0,	2,	888000000U),
PLLPERIPH0(148,	0,	4,	894000000U),
PLLPERIPH0(74,	0,	2,	900000000U),
PLLPERIPH0(150,	0,	4,	906000000U),
PLLPERIPH0(75,	0,	2,	912000000U),
PLLPERIPH0(152,	0,	4,	918000000U),
PLLPERIPH0(76,	0,	2,	924000000U),
PLLPERIPH0(154,	0,	4,	930000000U),
PLLPERIPH0(77,	0,	2,	936000000U),
PLLPERIPH0(156,	0,	4,	942000000U),
PLLPERIPH0(78,	0,	2,	948000000U),
PLLPERIPH0(158,	0,	4,	954000000U),
PLLPERIPH0(79,	0,	2,	960000000U),
PLLPERIPH0(160,	0,	4,	966000000U),
PLLPERIPH0(80,	0,	2,	972000000U),
PLLPERIPH0(162,	0,	4,	978000000U),
PLLPERIPH0(81,	0,	2,	984000000U),
PLLPERIPH0(164,	0,	4,	990000000U),
PLLPERIPH0(82,	0,	2,	996000000U),
PLLPERIPH0(166,	0,	4,	1002000000U),
PLLPERIPH0(83,	0,	2,	1008000000U),
PLLPERIPH0(168,	0,	4,	1014000000U),
PLLPERIPH0(84,	0,	2,	1020000000U),
PLLPERIPH0(170,	0,	4,	1026000000U),
PLLPERIPH0(85,	0,	2,	1032000000U),
PLLPERIPH0(172,	0,	4,	1038000000U),
PLLPERIPH0(86,	0,	2,	1044000000U),
PLLPERIPH0(174,	0,	4,	1050000000U),
PLLPERIPH0(87,	0,	2,	1056000000U),
PLLPERIPH0(176,	0,	4,	1062000000U),
PLLPERIPH0(88,	0,	2,	1068000000U),
PLLPERIPH0(178,	0,	4,	1074000000U),
PLLPERIPH0(89,	0,	2,	1080000000U),
PLLPERIPH0(180,	0,	4,	1086000000U),
PLLPERIPH0(90,	0,	2,	1092000000U),
PLLPERIPH0(182,	0,	4,	1098000000U),
PLLPERIPH0(91,	0,	2,	1104000000U),
PLLPERIPH0(184,	0,	4,	1110000000U),
PLLPERIPH0(92,	0,	2,	1116000000U),
PLLPERIPH0(186,	0,	4,	1122000000U),
PLLPERIPH0(93,	0,	2,	1128000000U),
PLLPERIPH0(188,	0,	4,	1134000000U),
PLLPERIPH0(94,	0,	2,	1140000000U),
PLLPERIPH0(190,	0,	4,	1146000000U),
PLLPERIPH0(95,	0,	2,	1152000000U),
PLLPERIPH0(192,	0,	4,	1158000000U),
PLLPERIPH0(96,	0,	2,	1164000000U),
PLLPERIPH0(194,	0,	4,	1170000000U),
PLLPERIPH0(97,	0,	2,	1176000000U),
PLLPERIPH0(196,	0,	4,	1182000000U),
PLLPERIPH0(98,	0,	2,	1188000000U),
PLLPERIPH0(198,	0,	4,	1194000000U),
#endif
PLLPERIPH0(99,	0,	2,	1200000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLPERIPH0(200,	0,	4,	1206000000U),
PLLPERIPH0(100,	0,	2,	1212000000U),
PLLPERIPH0(202,	0,	4,	1218000000U),
PLLPERIPH0(101,	0,	2,	1224000000U),
PLLPERIPH0(204,	0,	4,	1230000000U),
PLLPERIPH0(102,	0,	2,	1236000000U),
PLLPERIPH0(206,	0,	4,	1242000000U),
PLLPERIPH0(103,	0,	2,	1248000000U),
PLLPERIPH0(208,	0,	4,	1254000000U),
PLLPERIPH0(104,	0,	2,	1260000000U),
PLLPERIPH0(105,	0,	2,	1272000000U),
PLLPERIPH0(106,	0,	2,	1284000000U),
PLLPERIPH0(107,	0,	2,	1296000000U),
PLLPERIPH0(108,	0,	2,	1308000000U),
PLLPERIPH0(109,	0,	2,	1320000000U),
PLLPERIPH0(110,	0,	2,	1332000000U),
PLLPERIPH0(111,	0,	2,	1344000000U),
PLLPERIPH0(112,	0,	2,	1356000000U),
PLLPERIPH0(113,	0,	2,	1368000000U),
PLLPERIPH0(114,	0,	2,	1380000000U),
PLLPERIPH0(115,	0,	2,	1392000000U),
PLLPERIPH0(116,	0,	2,	1404000000U),
PLLPERIPH0(117,	0,	2,	1416000000U),
PLLPERIPH0(118,	0,	2,	1428000000U),
PLLPERIPH0(119,	0,	2,	1440000000U),
PLLPERIPH0(120,	0,	2,	1452000000U),
PLLPERIPH0(121,	0,	2,	1464000000U),
PLLPERIPH0(122,	0,	2,	1476000000U),
PLLPERIPH0(123,	0,	2,	1488000000U),
PLLPERIPH0(124,	0,	2,	1500000000U),
PLLPERIPH0(125,	0,	2,	1512000000U),
PLLPERIPH0(126,	0,	2,	1524000000U),
PLLPERIPH0(127,	0,	2,	1536000000U),
PLLPERIPH0(128,	0,	2,	1548000000U),
PLLPERIPH0(129,	0,	2,	1560000000U),
PLLPERIPH0(130,	0,	2,	1572000000U),
PLLPERIPH0(131,	0,	2,	1584000000U),
PLLPERIPH0(132,	0,	2,	1596000000U),
PLLPERIPH0(133,	0,	2,	1608000000U),
PLLPERIPH0(134,	0,	2,	1620000000U),
PLLPERIPH0(135,	0,	2,	1632000000U),
PLLPERIPH0(136,	0,	2,	1644000000U),
PLLPERIPH0(137,	0,	2,	1656000000U),
PLLPERIPH0(104,	0,	2,	1260000000U),
PLLPERIPH0(105,	0,	2,	1272000000U),
PLLPERIPH0(106,	0,	2,	1284000000U),
PLLPERIPH0(107,	0,	2,	1296000000U),
PLLPERIPH0(108,	0,	2,	1308000000U),
PLLPERIPH0(109,	0,	2,	1320000000U),
PLLPERIPH0(110,	0,	2,	1332000000U),
PLLPERIPH0(111,	0,	2,	1344000000U),
PLLPERIPH0(112,	0,	2,	1356000000U),
PLLPERIPH0(113,	0,	2,	1368000000U),
PLLPERIPH0(114,	0,	2,	1380000000U),
PLLPERIPH0(115,	0,	2,	1392000000U),
PLLPERIPH0(116,	0,	2,	1404000000U),
PLLPERIPH0(117,	0,	2,	1416000000U),
PLLPERIPH0(118,	0,	2,	1428000000U),
PLLPERIPH0(104,	0,	2,	1260000000U),
PLLPERIPH0(105,	0,	2,	1272000000U),
PLLPERIPH0(106,	0,	2,	1284000000U),
PLLPERIPH0(107,	0,	2,	1296000000U),
PLLPERIPH0(108,	0,	2,	1308000000U),
PLLPERIPH0(109,	0,	2,	1320000000U),
PLLPERIPH0(110,	0,	2,	1332000000U),
PLLPERIPH0(111,	0,	2,	1344000000U),
PLLPERIPH0(112,	0,	2,	1356000000U),
PLLPERIPH0(113,	0,	2,	1368000000U),
PLLPERIPH0(114,	0,	2,	1380000000U),
PLLPERIPH0(115,	0,	2,	1392000000U),
PLLPERIPH0(116,	0,	2,	1404000000U),
PLLPERIPH0(117,	0,	2,	1416000000U),
PLLPERIPH0(118,	0,	2,	1428000000U),
PLLPERIPH0(119,	0,	2,	1440000000U),
PLLPERIPH0(120,	0,	2,	1452000000U),
PLLPERIPH0(121,	0,	2,	1464000000U),
PLLPERIPH0(122,	0,	2,	1476000000U),
PLLPERIPH0(123,	0,	2,	1488000000U),
PLLPERIPH0(124,	0,	2,	1500000000U),
PLLPERIPH0(125,	0,	2,	1512000000U),
PLLPERIPH0(126,	0,	2,	1524000000U),
PLLPERIPH0(127,	0,	2,	1536000000U),
PLLPERIPH0(128,	0,	2,	1548000000U),
PLLPERIPH0(129,	0,	2,	1560000000U),
PLLPERIPH0(130,	0,	2,	1572000000U),
PLLPERIPH0(131,	0,	2,	1584000000U),
PLLPERIPH0(132,	0,	2,	1596000000U),
PLLPERIPH0(133,	0,	2,	1608000000U),
PLLPERIPH0(134,	0,	2,	1620000000U),
PLLPERIPH0(135,	0,	2,	1632000000U),
PLLPERIPH0(136,	0,	2,	1644000000U),
PLLPERIPH0(137,	0,	2,	1656000000U),
PLLPERIPH0(138,	0,	2,	1668000000U),
PLLPERIPH0(139,	0,	2,	1680000000U),
PLLPERIPH0(140,	0,	2,	1692000000U),
PLLPERIPH0(141,	0,	2,	1704000000U),
PLLPERIPH0(142,	0,	2,	1716000000U),
PLLPERIPH0(143,	0,	2,	1728000000U),
PLLPERIPH0(144,	0,	2,	1740000000U),
PLLPERIPH0(145,	0,	2,	1752000000U),
#endif
};

struct sunxi_clk_factor_freq factor_pllperiph0480m_tbl[] = {
#ifndef CONFIG_SUNXI_FASTBOOT
PLLPERIPH0(23,	0,	1,	288000000U),
PLLPERIPH0(24,	0,	1,	300000000U),
PLLPERIPH0(25,	0,	1,	312000000U),
PLLPERIPH0(26,	0,	1,	324000000U),
PLLPERIPH0(27,	0,	1,	336000000U),
PLLPERIPH0(28,	0,	1,	348000000U),
PLLPERIPH0(29,	0,	1,	360000000U),
PLLPERIPH0(30,	0,	1,	372000000U),
PLLPERIPH0(31,	0,	1,	384000000U),
PLLPERIPH0(32,	0,	1,	396000000U),
PLLPERIPH0(33,	0,	1,	408000000U),
PLLPERIPH0(34,	0,	1,	420000000U),
PLLPERIPH0(35,	0,	1,	432000000U),
PLLPERIPH0(36,	0,	1,	444000000U),
PLLPERIPH0(37,	0,	1,	456000000U),
PLLPERIPH0(38,	0,	1,	468000000U),
PLLPERIPH0(39,	0,	1,	480000000U),
PLLPERIPH0(40,	0,	1,	492000000U),
PLLPERIPH0(41,	0,	1,	504000000U),
PLLPERIPH0(42,	0,	1,	516000000U),
PLLPERIPH0(21,	0,	0,	528000000U),
PLLPERIPH0(44,	0,	1,	540000000U),
PLLPERIPH0(22,	0,	0,	552000000U),
PLLPERIPH0(46,	0,	1,	564000000U),
PLLPERIPH0(23,	0,	0,	576000000U),
PLLPERIPH0(48,	0,	1,	588000000U),
PLLPERIPH0(24,	0,	0,	600000000U),
PLLPERIPH0(50,	0,	1,	612000000U),
PLLPERIPH0(25,	0,	0,	624000000U),
PLLPERIPH0(52,	0,	1,	636000000U),
PLLPERIPH0(26,	0,	0,	648000000U),
PLLPERIPH0(54,	0,	1,	660000000U),
PLLPERIPH0(27,	0,	0,	672000000U),
PLLPERIPH0(56,	0,	1,	684000000U),
PLLPERIPH0(28,	0,	0,	696000000U),
PLLPERIPH0(58,	0,	1,	708000000U),
PLLPERIPH0(29,	0,	0,	720000000U),
PLLPERIPH0(60,	0,	1,	732000000U),
PLLPERIPH0(30,	0,	0,	744000000U),
PLLPERIPH0(62,	0,	1,	756000000U),
PLLPERIPH0(31,	0,	0,	768000000U),
PLLPERIPH0(64,	0,	1,	780000000U),
PLLPERIPH0(32,	0,	0,	792000000U),
PLLPERIPH0(66,	0,	1,	804000000U),
PLLPERIPH0(33,	0,	0,	816000000U),
PLLPERIPH0(68,	0,	1,	828000000U),
PLLPERIPH0(34,	0,	0,	840000000U),
PLLPERIPH0(70,	0,	1,	852000000U),
PLLPERIPH0(35,	0,	0,	864000000U),
PLLPERIPH0(72,	0,	1,	876000000U),
PLLPERIPH0(36,	0,	0,	888000000U),
PLLPERIPH0(74,	0,	1,	900000000U),
PLLPERIPH0(37,	0,	0,	912000000U),
PLLPERIPH0(76,	0,	1,	924000000U),
PLLPERIPH0(38,	0,	0,	936000000U),
PLLPERIPH0(78,	0,	1,	948000000U),
PLLPERIPH0(39,	0,	0,	960000000U),
PLLPERIPH0(80,	0,	1,	972000000U),
PLLPERIPH0(40,	0,	0,	984000000U),
PLLPERIPH0(82,	0,	1,	996000000U),
PLLPERIPH0(41,	0,	0,	1008000000U),
PLLPERIPH0(84,	0,	1,	1020000000U),
PLLPERIPH0(42,	0,	0,	1032000000U),
PLLPERIPH0(86,	0,	1,	1044000000U),
PLLPERIPH0(43,	0,	0,	1056000000U),
PLLPERIPH0(88,	0,	1,	1068000000U),
PLLPERIPH0(44,	0,	0,	1080000000U),
PLLPERIPH0(90,	0,	1,	1092000000U),
PLLPERIPH0(45,	0,	0,	1104000000U),
PLLPERIPH0(92,	0,	1,	1116000000U),
PLLPERIPH0(46,	0,	0,	1128000000U),
PLLPERIPH0(94,	0,	1,	1140000000U),
PLLPERIPH0(47,	0,	0,	1152000000U),
PLLPERIPH0(96,	0,	1,	1164000000U),
PLLPERIPH0(48,	0,	0,	1176000000U),
PLLPERIPH0(98,	0,	1,	1188000000U),
#endif
PLLPERIPH0(99,	0,	4,	1200000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLPERIPH0(50,	0,	0,	1224000000U),
PLLPERIPH0(51,	0,	0,	1248000000U),
PLLPERIPH0(52,	0,	0,	1272000000U),
PLLPERIPH0(53,	0,	0,	1296000000U),
PLLPERIPH0(54,	0,	0,	1320000000U),
PLLPERIPH0(55,	0,	0,	1344000000U),
PLLPERIPH0(56,	0,	0,	1368000000U),
PLLPERIPH0(57,	0,	0,	1392000000U),
PLLPERIPH0(58,	0,	0,	1416000000U),
PLLPERIPH0(59,	0,	0,	1440000000U),
PLLPERIPH0(60,	0,	0,	1464000000U),
PLLPERIPH0(61,	0,	0,	1488000000U),
PLLPERIPH0(62,	0,	0,	1512000000U),
PLLPERIPH0(63,	0,	0,	1536000000U),
PLLPERIPH0(64,	0,	0,	1560000000U),
PLLPERIPH0(65,	0,	0,	1584000000U),
PLLPERIPH0(66,	0,	0,	1608000000U),
PLLPERIPH0(67,	0,	0,	1632000000U),
PLLPERIPH0(68,	0,	0,	1656000000U),
PLLPERIPH0(69,	0,	0,	1680000000U),
PLLPERIPH0(70,	0,	0,	1704000000U),
PLLPERIPH0(71,	0,	0,	1728000000U),
PLLPERIPH0(72,	0,	0,	1752000000U),
PLLPERIPH0(73,	0,	0,	1776000000U),
PLLPERIPH0(74,	0,	0,	1800000000U),
PLLPERIPH0(75,	0,	0,	1824000000U),
PLLPERIPH0(76,	0,	0,	1848000000U),
PLLPERIPH0(77,	0,	0,	1872000000U),
PLLPERIPH0(78,	0,	0,	1896000000U),
PLLPERIPH0(79,	0,	0,	1920000000U),
PLLPERIPH0(80,	0,	0,	1944000000U),
PLLPERIPH0(81,	0,	0,	1968000000U),
PLLPERIPH0(82,	0,	0,	1992000000U),
PLLPERIPH0(83,	0,	0,	2016000000U),
PLLPERIPH0(84,	0,	0,	2040000000U),
PLLPERIPH0(85,	0,	0,	2064000000U),
PLLPERIPH0(86,	0,	0,	2088000000U),
PLLPERIPH0(87,	0,	0,	2112000000U),
PLLPERIPH0(88,	0,	0,	2136000000U),
PLLPERIPH0(89,	0,	0,	2160000000U),
PLLPERIPH0(90,	0,	0,	2184000000U),
PLLPERIPH0(91,	0,	0,	2208000000U),
PLLPERIPH0(92,	0,	0,	2232000000U),
PLLPERIPH0(93,	0,	0,	2256000000U),
PLLPERIPH0(94,	0,	0,	2280000000U),
PLLPERIPH0(95,	0,	0,	2304000000U),
PLLPERIPH0(96,	0,	0,	2328000000U),
PLLPERIPH0(97,	0,	0,	2352000000U),
PLLPERIPH0(98,	0,	0,	2376000000U),
PLLPERIPH0(99,	0,	0,	2400000000U),
PLLPERIPH0(100,	0,	0,	2424000000U),
PLLPERIPH0(101,	0,	0,	2448000000U),
PLLPERIPH0(102,	0,	0,	2472000000U),
PLLPERIPH0(103,	0,	0,	2496000000U),
PLLPERIPH0(104,	0,	0,	2520000000U),
#endif
};

/* PLLVIDEO0(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllvideo0x4_tbl[] = {
#ifndef CONFIG_SUNXI_FASTBOOT
PLLVIDEO0(23,	1,	288000000U),
PLLVIDEO0(24,	1,	300000000U),
PLLVIDEO0(25,	1,	312000000U),
PLLVIDEO0(26,	1,	324000000U),
PLLVIDEO0(27,	1,	336000000U),
PLLVIDEO0(28,	1,	348000000U),
PLLVIDEO0(29,	1,	360000000U),
PLLVIDEO0(30,	1,	372000000U),
PLLVIDEO0(31,	1,	384000000U),
PLLVIDEO0(32,	1,	396000000U),
#endif
PLLVIDEO0(33,	1,	408000000U),
PLLVIDEO0(34,	1,	420000000U),
PLLVIDEO0(35,	1,	432000000U),
PLLVIDEO0(36,	1,	444000000U),
PLLVIDEO0(37,	1,	456000000U),
PLLVIDEO0(38,	1,	468000000U),
PLLVIDEO0(39,	1,	480000000U),
PLLVIDEO0(40,	1,	492000000U),
PLLVIDEO0(41,	1,	504000000U),
PLLVIDEO0(42,	1,	516000000U),
PLLVIDEO0(43,	1,	528000000U),
PLLVIDEO0(44,	1,	540000000U),
PLLVIDEO0(45,	1,	552000000U),
PLLVIDEO0(46,	1,	564000000U),
PLLVIDEO0(23,	0,	576000000U),
PLLVIDEO0(48,	1,	588000000U),
PLLVIDEO0(24,	0,	600000000U),
PLLVIDEO0(50,	1,	612000000U),
PLLVIDEO0(25,	0,	624000000U),
PLLVIDEO0(52,	1,	636000000U),
PLLVIDEO0(26,	0,	648000000U),
PLLVIDEO0(54,	1,	660000000U),
PLLVIDEO0(27,	0,	672000000U),
PLLVIDEO0(56,	1,	684000000U),
PLLVIDEO0(28,	0,	696000000U),
PLLVIDEO0(58,	1,	708000000U),
PLLVIDEO0(29,	0,	720000000U),
PLLVIDEO0(60,	1,	732000000U),
PLLVIDEO0(30,	0,	744000000U),
PLLVIDEO0(62,	1,	756000000U),
PLLVIDEO0(31,	0,	768000000U),
PLLVIDEO0(64,	1,	780000000U),
PLLVIDEO0(32,	0,	792000000U),
PLLVIDEO0(66,	1,	804000000U),
PLLVIDEO0(33,	0,	816000000U),
PLLVIDEO0(68,	1,	828000000U),
PLLVIDEO0(34,	0,	840000000U),
PLLVIDEO0(70,	1,	852000000U),
PLLVIDEO0(35,	0,	864000000U),
PLLVIDEO0(72,	1,	876000000U),
PLLVIDEO0(36,	0,	888000000U),
PLLVIDEO0(74,	1,	900000000U),
PLLVIDEO0(37,	0,	912000000U),
PLLVIDEO0(76,	1,	924000000U),
PLLVIDEO0(38,	0,	936000000U),
PLLVIDEO0(78,	1,	948000000U),
PLLVIDEO0(39,	0,	960000000U),
PLLVIDEO0(80,	1,	972000000U),
PLLVIDEO0(40,	0,	984000000U),
PLLVIDEO0(82,	1,	996000000U),
PLLVIDEO0(41,	0,	1008000000U),
PLLVIDEO0(84,	1,	1020000000U),
PLLVIDEO0(42,	0,	1032000000U),
PLLVIDEO0(86,	1,	1044000000U),
PLLVIDEO0(43,	0,	1056000000U),
PLLVIDEO0(88,	1,	1068000000U),
PLLVIDEO0(44,	0,	1080000000U),
PLLVIDEO0(90,	1,	1092000000U),
PLLVIDEO0(45,	0,	1104000000U),
PLLVIDEO0(92,	1,	1116000000U),
PLLVIDEO0(46,	0,	1128000000U),
PLLVIDEO0(94,	1,	1140000000U),
PLLVIDEO0(47,	0,	1152000000U),
PLLVIDEO0(96,	1,	1164000000U),
PLLVIDEO0(48,	0,	1176000000U),
PLLVIDEO0(98,	1,	1188000000U),
PLLVIDEO0(49,	0,	1200000000U),
PLLVIDEO0(100,	1,	1212000000U),
PLLVIDEO0(50,	0,	1224000000U),
PLLVIDEO0(102,	1,	1236000000U),
PLLVIDEO0(51,	0,	1248000000U),
PLLVIDEO0(104,	1,	1260000000U),
PLLVIDEO0(52,	0,	1272000000U),
PLLVIDEO0(106,	1,	1284000000U),
PLLVIDEO0(53,	0,	1296000000U),
PLLVIDEO0(108,	1,	1308000000U),
PLLVIDEO0(54,	0,	1320000000U),
PLLVIDEO0(110,	1,	1332000000U),
PLLVIDEO0(55,	0,	1344000000U),
PLLVIDEO0(112,	1,	1356000000U),
PLLVIDEO0(56,	0,	1368000000U),
PLLVIDEO0(114,	1,	1380000000U),
PLLVIDEO0(57,	0,	1392000000U),
PLLVIDEO0(116,	1,	1404000000U),
PLLVIDEO0(58,	0,	1416000000U),
PLLVIDEO0(118,	1,	1428000000U),
PLLVIDEO0(59,	0,	1440000000U),
PLLVIDEO0(120,	1,	1452000000U),
PLLVIDEO0(60,	0,	1464000000U),
PLLVIDEO0(122,	1,	1476000000U),
PLLVIDEO0(61,	0,	1488000000U),
PLLVIDEO0(124,	1,	1500000000U),
PLLVIDEO0(62,	0,	1512000000U),
PLLVIDEO0(126,	1,	1524000000U),
PLLVIDEO0(63,	0,	1536000000U),
PLLVIDEO0(128,	1,	1548000000U),
PLLVIDEO0(64,	0,	1560000000U),
PLLVIDEO0(130,	1,	1572000000U),
PLLVIDEO0(65,	0,	1584000000U),
PLLVIDEO0(132,	1,	1596000000U),
PLLVIDEO0(66,	0,	1608000000U),
PLLVIDEO0(134,	1,	1620000000U),
PLLVIDEO0(67,	0,	1632000000U),
PLLVIDEO0(136,	1,	1644000000U),
PLLVIDEO0(68,	0,	1656000000U),
PLLVIDEO0(138,	1,	1668000000U),
PLLVIDEO0(69,	0,	1680000000U),
PLLVIDEO0(140,	1,	1692000000U),
#ifndef CONFIG_SUNXI_FASTBOOT
PLLVIDEO0(70,	0,	1704000000U),
PLLVIDEO0(71,	0,	1728000000U),
PLLVIDEO0(72,	0,	1752000000U),
PLLVIDEO0(74,	0,	1800000000U),
PLLVIDEO0(76,	0,	1848000000U),
PLLVIDEO0(78,	0,	1896000000U),
PLLVIDEO0(80,	0,	1944000000U),
PLLVIDEO0(82,	0,	1992000000U),
PLLVIDEO0(84,	0,	2040000000U),
PLLVIDEO0(86,	0,	2088000000U),
PLLVIDEO0(88,	0,	2136000000U),
PLLVIDEO0(90,	0,	2184000000U),
PLLVIDEO0(92,	0,	2232000000U),
PLLVIDEO0(94,	0,	2280000000U),
PLLVIDEO0(96,	0,	2328000000U),
PLLVIDEO0(98,	0,	2376000000U),
PLLVIDEO0(100,	0,	2424000000U),
PLLVIDEO0(102,	0,	2472000000U),
PLLVIDEO0(104,	0,	2520000000U),
#endif
};

/* PLL_CSI(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllcsix4_tbl[] = {
PLLCSI(98,     1,     1188000000U),
PLLCSI(98,     0,     2376000000U),
};

/* PLLAUDIO(n, p, d1, d2, freq)	F_N8X8_P16X6_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllaudio_tbl[] = {
PLLAUDIO(11,    0,    0,    0,    288000000U),
};

/* PLL_NPU(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllnpux4_tbl[] = {
PLLNPU(24,     1,      300000000U),
PLLNPU(28,     1,      348000000U),
PLLNPU(17,     0,      432000000U),
PLLNPU(40,     1,      492000000U),
PLLNPU(20,     0,      504000000U),
PLLNPU(21,     0,      528000000U),
PLLNPU(22,     0,      552000000U),
PLLNPU(23,     0,      576000000U),
PLLNPU(24,     0,      600000000U),
PLLNPU(25,     0,      624000000U),
PLLNPU(26,     0,      648000000U),
PLLNPU(27,     0,      672000000U),
PLLNPU(28,     0,      696000000U),
PLLNPU(41,     0,     1008000000U),
PLLNPU(57,     0,     1392000000U),
};

static unsigned int pllcpu_max, pllddr0_max, pllperiph0x2_max,
		    pllperiph0800m_max, pllperiph0480m_max, pllvideo0x4_max,
		    pllcsix4_max, pllnpux4_max;

#define PLL_MAX_ASSIGN(name) (pll##name##_max = \
	factor_pll##name##_tbl[ARRAY_SIZE(factor_pll##name##_tbl)-1].freq)

void sunxi_clk_factor_initlimits(void)
{
	PLL_MAX_ASSIGN(cpu);
	PLL_MAX_ASSIGN(ddr0);
	PLL_MAX_ASSIGN(periph0x2);
	PLL_MAX_ASSIGN(periph0800m);
	PLL_MAX_ASSIGN(periph0480m);
	PLL_MAX_ASSIGN(video0x4);
	PLL_MAX_ASSIGN(csix4);
	PLL_MAX_ASSIGN(npux4);
}
